import { createApp } from "vue";
// 全局样式
import "@/styles/index";
// svg icons
import "virtual:svg-icons-register";
// 自定义指令
import directives from "@/directives/index";
// 路由
import router from "@/routers/index";
// vue i18n
import I18n from "@/languages/index";
// 全局状态
import pinia from "@/stores";
// errorHandler
import errorHandler from "@/utils/errorHandler";
import App from "./App.vue";
const app = createApp(App);

app.config.errorHandler = errorHandler;
// document.documentElement.style.setProperty("--el-color-primary", "blue");
//监听页面可见状态变更
document.addEventListener("visibilitychange", e => {
  if (document.visibilityState === "visible" || document.hidden === false) {
    //TO-DO store的报错信息 log.error
    console.log("页面唤醒可见");
  } else {
    console.log("页面隐藏不可见");
  }
});
//监听页面加载和卸载
window.addEventListener("load", () => {
  console.log("页面加载");
});
app.use(directives).use(router).use(I18n).use(pinia).mount("#app");
